<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>Gestion des commentaires</title>
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <link rel="stylesheet" type="text/css" href="../default.css" />
        <script type="text/javascript" src="../jquery.js"></script>
        <script type="text/javascript" src="../scripts.js"></script>

    </head>
    <body>
        <div id="upbg"></div>
        <div id="outer">
            <?php
            include '../headerAdmin.php';
            include '../menuAdmin.php';
            ?>
            <div id="content">
                <?php
                include "../connectBDD.php";
                //On vérifie l'existance de l'event
                if (isset($_GET['idEvent'])) {
                    $id_event = $_GET['idEvent'];
                    $query = "select * from comments where id_event = $id_event";
                    $result = mysql_query($query) or die(mysql_error());
                    $nb_res = mysql_num_rows($result);
                    $query = "select name_event from event where id_event = $id_event";
                    $result2 = mysql_query($query);
                    $row2 = mysql_fetch_assoc($result2);
                    echo"<div class='sousTitreInfoInscription'>Commentaires pour l'évenement : <span style='color:red'>" . $row2['name_event'] . "</span></div>";

                    echo "<div id='content_com'>";
                    echo "<div style='color:green;text-align:center;'>$nb_res commentaire(s) trouvé(s) trouvé(s)</div>";
                    if (mysql_num_rows($result) <= 0) {
                        echo "<div class='no_result_found'>Aucun commentaire.</div>";
                    } else {
                        echo "<div class='comments'>";
                        while ($row = mysql_fetch_assoc($result)) {
                            echo"
                         <div id='comment'>
                            <a class='croix_ferm' href=\"javascript:supprimerCommentaire('" . $row['id_comment'] . "', $id_event, 'admin')\"><img src='../images/Close-32.png' height='17px' width='15px'/></a>
                                <div id='login_msg'>
                                    <a href='profil.php?login=" . $row['login'] . "'>" . $row['login'] . "</a>
                                     <span class='heure_msg'>" . $row['dateTime'] . "</span>
                                </div>
                                <div id='msg_content'>" . substr($row['comment'], 0, 100) . "</div>
                        </div>";
                        }
                        echo "</div>";
                    }
                    echo "</div>";
                }
                ?>


            </div>
<?php
include '../footer.php';
?>
        </div>

    </body>
</html>